package com.xym.manage.service;

import java.util.ArrayList;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.abel533.mapper.Mapper;
import com.xym.manage.mapper.ContentMapper;
import com.xym.manage.pojo.Content;

@Service
public class ContentService extends BaseService<Content>{

	@Autowired
	private ContentMapper contentMapper;
	
	@Override
	public Mapper<Content> getMapper() {
		
		return this.contentMapper;
	}


	/**
	 * 新增内容
	 * @param content
	 * @return
	 */
	public Boolean saveContent(Content content) {
		int i = this.saveSelective(content);
		if(i>0){
			return true;
		}
		return false;
	}


	/**
	 * 编辑内容
	 * @param content
	 * @return
	 */
	public Boolean editContent(Content content) {
		Integer i = this.updateSelective(content);
		if(i>0){
			return true;
		}
		return false;
	}


	/**
	 * 删除内容
	 * @param ids
	 * @return
	 */
	public Boolean deleteContent(Long[] ids) {
		  ArrayList<Object> list = new ArrayList<Object>();
		  for (Long id : ids) {
			  list.add(id);
		}
		  Integer i = this.deleteByIds("id", list, Content.class);
		  if(i>0){
			  return true;
		  }
		return false;
	}

}
